﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Backend.JYD.Model;

namespace Backend.JYD.BLL
{
    public class EmpRoleInfoBLL
    {
        private static readonly IDAL.IEmpRoleInfo idal = Factory.DALFactory.CreateEFDAL<IDAL.IEmpRoleInfo>("DAL.EmpRoleInfoDAL");

        public Int64 AddEmpRoleInfo(EmpRoleInfo info)
        {
            if (info.RoleId <= 0) return 0;
            if (info.EmpId <= 0) return 0;
            return idal.AddEmpRoleInfo(info);
        }

        public bool UpdateEmpRoleInfo(EmpRoleInfo info)
        {
            if (info.RoleId <= 0) return false;
            if (info.EmpId <= 0) return false;
            return idal.UpdateEmpRoleInfo(info);
        }

        public bool DeleteEmpRoleInfo(Int64 empId, Int64 roleId)
        {
            if (roleId <= 0) return false;
            if (empId <= 0) return false;
            return idal.DeleteEmpRoleInfo(empId, roleId);
        }

        public IList<EmpRoleInfo> GetEmpRoleInfoByEmpId(Int64 empId)
        {
            if (empId <= 0) return null;
            return idal.GetEmpRoleInfoByEmpId(empId);
        }

        public IList<EmpRoleInfo> GetEmpRoleInfoByRoleId(Int64 roleId)
        {
            if (roleId <= 0) return null;
            return idal.GetEmpRoleInfoByEmpId(roleId);
        }
        public IList<EmpRoleInfo> GetEmpRoleInfoByEmpIds(string empIds)
        {
            if (string.IsNullOrWhiteSpace(empIds)) return null;
            return idal.GetEmpRoleInfoByEmpIds(empIds);
        }

        public IList<EmpRoleInfo> GetEmpRoleInfoByRoleIds(string roleIds)
        {
            if (string.IsNullOrWhiteSpace(roleIds)) return null;
            return idal.GetEmpRoleInfoByRoleIds(roleIds);
        }

        public PageInfo<EmpRoleInfo> GetEmpRoleInfoByPage(PageInfo page)
        {
            return idal.GetEmpRoleInfoByPage(page);
        }

        public IList<EmpRoleInfo> GetAllEmpRoleInfo()
        {
            return idal.GetAllEmpRoleInfo();
        }
    }
}
